import request from '@/utils/request';

/**
 * 2.7.1 餐厅组列表/coupon-config/storegroup/search
 */
export async function storegroupSearch(data: API.StoregroupSearchInfo, options?: API.baseOption) {
  return request<API.BasePaginationRes<API.StoregroupListItem>>('/storegroup/search', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.7.2 餐厅组详情/coupon-config/storegroup/detail
 */
export async function storegroupDetail(data: { id: string }, options?: API.baseOption) {
  return request<API.StoregroupListItem>('/storegroup/detail', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.7.3 餐厅组修改/coupon-config/storegroup/edit
 */
export async function storegroupEdit(data: API.ActivatecodeListItem, options?: API.baseOption) {
  return request<string>('/storegroup/edit', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.7.4 餐厅组刷新/coupon-config/storegroup/refresh
 */
export async function storegroupRefresh(data: { storegroup?: string }, options?: API.baseOption) {
  return request<string>('/storegroup/refresh', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.7.5 餐厅组门店列表/coupon-config/storegroup/store-list
 */
export async function storegroupStoreList(data: { storegroup?: string }, options?: API.baseOption) {
  return request<{ stores: string }>('/storegroup/store-list', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.7.6 餐厅组门店修改/coupon-config/storegroup/store-edit
 */
export async function storegroupStoreEdit(
  data: { storegroup: string; stores: string },
  options?: API.baseOption,
) {
  return request<string>('/storegroup/store-edit', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.8.1 活动组列表查询/coupon-config/activitygroup/search
 */
export async function activitygroupSearch(data: API.ActivitygroupInfo, options?: API.baseOption) {
  return request<API.BasePaginationRes<API.ActivitygroupListItem>>('/activitygroup/search', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.8.2 活动组详情查询/coupon-config/activitygroup/detail
 */
export async function activitygroupDetail(data: { id: string }, options?: API.baseOption) {
  return request<API.ActivitygroupListItem>('/activitygroup/detail', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.8.3 活动组列表编辑/coupon-config/activitygroup/edit
 */
export async function activitygroupEdit(data: API.ActivitygroupListItem, options?: API.baseOption) {
  return request<string>('/activitygroup/edit', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.8.4 活动组列表删除/coupon-config/activitygroup/delete
 */
export async function activitygroupDelete(data: { id: string }, options?: API.baseOption) {
  return request<string>('/activitygroup/delete', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}
